import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/list',
    name: 'list',//路由规则的名字
    component: () => import(/* webpackChunkName: "about" */ '../views/list.vue'),
    meta:{
        keepAlive:true,//这是需要被缓存的组件
    }
  },
  {
    path: '/demo/:id',
    name: 'demo',
    component: () => import(/* webpackChunkName: "about" */ '../views/demo.vue')
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
